package it.patterns.behavioral.memento;

public class Originator {
	private String state;

	public Originator() {
		this.state = "-1";
	}
	public Memento createMemento() {
		return new ConcreteMemento();
	}

	public void doSomeStuff(int i) {
		this.state += i ;
	}

	public String getState() {
		return this.state;
	};

	class ConcreteMemento implements Memento {
		private String mem_state;

		public ConcreteMemento() {
			this.mem_state = state;
		}

		@Override
		public void restoreState() {
			state = mem_state;
		}

	}

}
